<script>
	var dodelete='__URL__/dodelete';
	var doclearplan='__URL__/doclearplan';
	var doautosetyuzhi='__URL__/doautosetyuzhi';
</script>
<!--table部分-->
<div class='col-md-12'>

	<div class="panel panel-default">
	  <div class="panel-body">
	    <button class='btn btn-danger btn-lg pull-left' onclick="clearplan()">清除计划数据</button>
		<button class='btn btn-success btn-lg triggerupload pull-left' id='doanalyseandupload'>分析上传数据</button>
		<button class='btn btn-info btn-lg pull-left' onclick="autosetyuzhi()">自动设置阈值产线速度</button>
		
		<!-- 必须是a标签 -->
	    <link rel="stylesheet" type="text/css" href="__PUBLIC__/etc/huploadify/html5uploader.css"/>
	    <script type="text/javascript" src="__PUBLIC__/etc/huploadify/jquery.html5uploader.js"></script>
	    <script>var dogivetail='__APP__/Hupldf/dogivetail';</script>
	    <script type="text/javascript">
	    $(function(){
	        $('#upload').html5uploader({
	            fileTypeExts:'',
	            auto:true,
	            multi:false,
	            removeTimeout:0,
	            url:'__APP__/Hupldf/upload/folder/part',//
	            onUploadStart:function(){
	                //alert('开始上传');
	                loading();
	                var timestamp = (new Date()).valueOf();
	            },
	            onInit:function(){
	                //alert('初始化');
	            },
	            onUploadComplete:function(file){
	                
	                $.post(
	                    '__URL__/fenxi',
	                    {},
	                    function(data){
	                        $('#loading_cancel').trigger('click');
	                        if(data['jieguo']==1){
	                            msg("上传完毕！",1);
                            
	                        }else if(data['jieguo']==2){
	                            
	                            msg(data['rslt'],1);
	                        }
	                        
	                    },
	                    'json'
	                );
	            }
	        });
	    });
	    </script>
	    <div id="upload" style='display:none'></div>

	    
	    <script type="text/javascript">
		$(function(){
		    $('.triggerupload').click(function(){
		        
		        $('#uploadfilebtn').trigger('click');
		    });
		})
		</script>

	  </div>
	</div>

	<!--开始-->
	<table class='table table-hover table-striped table-bordered' id='NBtb'>
		<thead>
			<tr style="background-color: #337ab7;color:#fff">
				<th>序号</th>
				<volist name='thls' id='thv'>
					<th>{$thv}</th>
				</volist>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<volist name='mls' id='mv'>
				<tr>
					<td>{$pagestart+$i}</td>
					<?php foreach ($mv as $key => $value) {
						if(!in_array($key,$hide_fld)){
					?>
						<td>{$value}</td>
					<?php 
						}
					} ?>
					<td>
					<?php if($atho['athv']){ ?><a class='btn btn-success btn-sm' href="__URL__/view/id/<?php echo $mv[$lowmdmk.'id'] ?>">查看</a><?php } ?>
					<?php if($atho['athm']){ ?><a class='btn btn-warning btn-sm' href="__URL__/update/id/<?php echo $mv[$lowmdmk.'id'] ?>">修改</a><?php } ?>
					<?php if($atho['athd']){ ?><a class='btn btn-danger btn-sm' onclick="dlt(<?php echo $mv[$lowmdmk.'id'] ?>)" >删除</a><?php } ?>
					</td>
				</tr>
			</volist>
			
		</tbody>
	</table>
	
	<!--结束-->
	{$page}
	<br><br><?php if($atho['atha']){ ?><a class='btn btn-primary' href='__URL__/update/id/0'>添加</a><?php } ?>
</div>

<script type="text/javascript">

</script>
<script type="text/javascript">$("#NBtb thead").smartFloatTB();</script>
<script type="text/javascript">
function dlt(id){
	if(confirm("{$deleteconfirm}")){
		$.ajax({
            'type': 'GET',
            'url':dodelete,
            'async':false,  
            'contentType': 'application/json',
            'data': {'id':id},
            'dataType': 'json',
            'success': function(data) {
            	msg('删除成功！',1);
            	console.log("success");
            },
            'error':function() {
                console.log("error");
            }
        });
	}
}
function clearplan(){
	
	$.ajax({
        'type': 'GET',
        'url':doclearplan,
        'async':false,  
        'contentType': 'application/json',
        'data': {},
        'dataType': 'json',
        'success': function(data) {
        	msg('清空成功！',1);
        	console.log("success");
        },
        'error':function() {
            console.log("error");
        }
    });
	
}

function autosetyuzhi(){
	
	$.ajax({
        'type': 'GET',
        'url':doautosetyuzhi,
        'async':false,  
        'contentType': 'application/json',
        'data': {},
        'dataType': 'json',
        'success': function(data) {
        	msg('自动设置阈值产线速度成功！');
        	console.log("success");
        },
        'error':function() {
            console.log("error");
        }
    });
	
}
</script>


